package com.sd.jdbc;
import java.sql.*;

public class Prepared {
	public static void main(String[] args) throws Exception{
	//registering the driver
		//Class.forName("oracle.jdbc.oracle.OracleDriver");
	DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
		System.out.println("driver registered");
		//Established connection
		Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","tiger");
		System.out.println("connection Established");
		//create prepared statement
		PreparedStatement ps=conn.prepareStatement("insert into Emp1 values(?,?)");
		System.out.println("statement prepared");
		//updating with values
ps.setInt(1,1008);


ps.setString(2,"aniket");


int i=ps.executeUpdate();
System.out.println(i + "records inserted");
		



		conn.close();
	}
	
	

}
